<%@ Control Language="C#" %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Register TagPrefix="CSD" Namespace="CommunityServer.Discussions.Controls" Assembly="CommunityServer.Discussions" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Controls" %>
<%@ Import Namespace="CommunityServer.Discussions.Components" %>
<%@ Import Namespace="CommunityServer.Discussions.Controls" %>

<script runat="server" language = "C#">

    protected string ReadLink(Thread thread)
    {
       if (ForumFormatter.HasRead(thread))
	    	return "ForumNameRead";
		else	
			return "ForumNameUnRead";
    }

</script>

<div class="CommonContentArea">
	<div class="CommonBreadCrumbArea"><CSD:BreadCrumb ShowHome="true" runat="server" id="Breadcrumb2"/></div>
	<CS:AdPart runat = "Server" contentname="StandardTop" ID="Adpart1">
	    <CS:Ads Zone="StandardTop" runat="server" id="Ads1" />
	</CS:AdPart>
	
	<h2 class="CommonTitle"><CSD:InlineTextEdit runat = "Server" id = "ForumName" /></h2>
	
	<div class="CommonContent">
	<div class="CommonDescription"><CSD:InlineTextEdit runat = "Server" id = "ForumDescription" /></div>
	
	<div class="CommonFilterArea" >
		<asp:label id="ForumFilterText" Runat="server">Forum:&nbsp;</asp:label><CSD:ForumDropDownList id="ForumDropDownList1" runat="server" AutoPostBack="true" />
		<CS:DateFilter id="DateFilter2" runat="server" Visible="false" AddText="false" AppendLineBreak="false" AutoPostBack="true" />
	</div>

	<div class="ForumSubArea" runat="server" id="SubForumContainer" visible="false">
		<CSD:ForumRepeater runat="server" EnableViewstate="false" ID="SubForumRepeater">										
			<HeaderTemplate>
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<thead>
					<tr> 
						<th colspan="2" nowrap="true" class="CommonListHeaderLeftMost ForumGroupImageAndNameHeader" align="center"><CS:ResourceLabel runat="server" ResourceName="ForumGroupView_Inline1" id="Resourcelabel14"/></th>
						<th nowrap="true" class="CommonListHeader ForumGroupLastPostHeader"><CS:ResourceLabel runat="server" ResourceName="ForumGroupView_Inline4" id="Resourcelabel15"/></th>                                    
						<th nowrap="true" class="CommonListHeader ForumGroupTotalThreadsHeader" align="center"><CS:ResourceLabel runat="server" ResourceName="ForumGroupView_Inline2" id="Resourcelabel16"/></th>                                    
						<th nowrap="true" class="CommonListHeader ForumGroupTotalPostsHeader" align="center"><CS:ResourceLabel runat="server" ResourceName="ForumGroupView_Inline3" id="Resourcelabel17"/></th>
					</tr>
				</thead>
				<tbody>
			</HeaderTemplate>
			<ItemTemplate>
				<tr>
					<td class="ForumListCellLeftMostImageOnly  ForumGroupImageColumn">
						<%# ForumFormatter.StatusIcon( (Forum) Container.DataItem ) %>
					</td>
					<td class="CommonListCell ForumGroupNameColumn">
						<a class="<%# ForumFormatter.HasRead((Forum) Container.DataItem) ? "ForumGroupNameRead" : "ForumGroupNameUnRead" %>" href="<%# ForumUrls.Instance().Forum( ((Forum) Container.DataItem).SectionID ) %>"><%# DataBinder.Eval(Container.DataItem, "Name") %></a> <%# ForumFormatter.FormatUsersViewingForum( (Forum) Container.DataItem ) %><br />
						<%# DataBinder.Eval(Container.DataItem, "Description") %><%# ForumFormatter.FormatSubForum( (Forum) Container.DataItem ) %>
					</td>
					<td class="CommonListCell ForumGroupLastPostColumn" nowrap="true">
						<%# ForumFormatter.FormatLastPost( (Forum) Container.DataItem, (bool) true ) %>
					</td>
					<td class="CommonListCell ForumGroupTotalThreadsColumn" align="center">
						<%# Formatter.FormatNumber( ((Forum) Container.DataItem).TotalThreads ) %>
					</td>                   						
					<td class="CommonListCell ForumGroupTotalPostsColumn" align="center">
						<%# Formatter.FormatNumber( ((Forum) Container.DataItem).TotalPosts ) %>
					</td>
				</tr>
			</ItemTemplate>
			<FooterTemplate>
				</tbody>
				</table>				
			</FooterTemplate>
		</CSD:ForumRepeater>	
	</div>
	
	<div class="CommonFormArea">
	<table cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
			<td align="left" class="CommonFormField">
				<CSD:ForumImageButton CssClass="CommonImageTextButtonBig" ButtonType="NewPost" runat="server" id="NewPostButton" /> 
				<%--CSD:ForumImageButton ButtonType="Poll" runat="server" id="Poll" /--%> 
			</td>
			<td valign="top">
				<asp:Panel id="DisplayPager2" Visible="True" Runat="server" align="right" CssClass="CommonPagingArea">
					<CS:CurrentPage Cssclass="columnText" id="CurrentPage2" runat="server" />
					<CSD:ForumPager id="Pager2" runat="server" />
				</asp:Panel>
			</td> 
		</tr>
	</table>
	</div>

	<cs:StatusMessage runat="server" id="NoThreadsToDisplay" Visible="true" Success="false" ResourceName="ViewThreads_NoTopics" />

	<asp:Repeater EnableViewState="False" id="Announcements" runat="server">
		<HeaderTemplate>
			<div class="CommonListArea">
			<h4 class="CommonListTitle"><CS:ResourceLabel runat="server" ResourceName="ViewThreads_FaqsAnnouncements" ID="Resourcelabel12"/></h4>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<thead>
					<tr>
						<th class="CommonListHeaderLeftMost ForumMyImageAndNameHeader" colspan="2"><CS:ResourceLabel runat="server" ResourceName="ViewThreads_TitleThread" id="Resourcelabel1"/></th>
						<th class="CommonListHeader ForumMyRepliesHeader"><CS:ResourceLabel runat="server" ResourceName="ViewThreads_TitleReplies" id="Resourcelabel3"/></th>
						<th id="moveThreadsColumnHeader" class="CommonListHeader ForumMyMoveHeader" runat="server" visible=<%# CSContext.Current.User.IsForumAdministrator | CSContext.Current.User.IsModerator %>>&nbsp;</th> 
					</tr>
				</thead>
				<tbody>
		</HeaderTemplate>
		<ItemTemplate>
				<tr>
					<td valign="middle" align="right" class="ForumListCellLeftMostImageOnly ForumMyImageColumn">
						<%# ForumFormatter.StatusIcon( (Thread) Container.DataItem ) %>
					</td>
					<td class="CommonListCell ForumMyNameColumn">
						<table width="100%" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td class="ForumSubListCellLeftMost"><%# Formatter.GetEmotionMarkup( ((Thread) Container.DataItem).EmoticonID ) %>
									<a class="<%# ReadLink((Thread) Container.DataItem) %>"
										title="<%# ( ForumConfiguration.Instance().EnablePostPreviewPopup && CSContext.Current.User.Profile.EnablePostPreviewPopup  ? Formatter.CheckStringLength(Formatter.StripAllTags(DataBinder.Eval(Container.DataItem, "Body").ToString()), 300) : String.Empty )%>" 
										href="<%# Globals.GetSiteUrls().Post( (int) DataBinder.Eval(Container.DataItem, "PostID") ) %> "> 
										<%# Formatter.CheckStringLength(DataBinder.Eval(Container.DataItem, "Subject").ToString(), 65) %>
									</a>
								</td>
								<td class="ForumSubListCell" align="right" nowrap="true">
									<CSD:RatePost IsReadOnly="true" PostID='<%# ((Thread) Container.DataItem).PostID %>' CurrentRating='<%# ((Thread) Container.DataItem).RatingAverage %>' CurrentVotes='<%# ((Thread) Container.DataItem).TotalRatings %>'  ThreadID='<%# ((Thread) Container.DataItem).ThreadID %>' Visible='<%# (CSContext.Current.SiteSettings.SectionRatingType == SectionRatingType.ThreadRating) %>' id="RateThread" runat="server" CssClass="CommonRateControl" ReadOnlyCssClass="CommonRateControlReadOnly" ActiveCssClass="CommonRateControlActive" ImagesBaseUrl="~/Themes/default/images/common/" />
									<CSD:ThreadStatusImage ThreadStatus='<%# ((Thread) Container.DataItem).Status %>' runat="server" id="ThreadItemStatusImage" />
								</td>
							</tr>
						</table>
						<table width="100%" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td class="ForumSubListCellLeftMost ForumLastPost">
									<%# ForumFormatter.FormatLastPost( (Thread) Container.DataItem, true ) %>
								</td>
								<td align="right" class="ForumSubListCell">
									<CSD:ThreadPager runat="server" ThreadID='<%# DataBinder.Eval(Container.DataItem, "PostID") %>' Replies='<%# DataBinder.Eval(Container.DataItem, "Replies") %>' id="Threadpager3" NAME="Threadpager2"/>
								</td>										
							</tr>
						</table>
					</td>
					<td class="CommonListCell ForumMyRepliesColumn">
						<%# Formatter.FormatNumber( ((Thread) Container.DataItem).Replies ) %>
					</td>
					<td runat="server" class="CommonListCell ForumMyMoveColumn" visible=<%# CSContext.Current.User.IsForumAdministrator | CSContext.Current.User.IsModerator %>>
						&nbsp;
					</td>
				</tr>								
		</ItemTemplate>				
		<FooterTemplate>
			</tbody>
			</table>
			</div>
		</FooterTemplate>
	</asp:Repeater>
	
	<asp:Repeater EnableViewState="False" id="Threads" runat="server">
		<HeaderTemplate>
			<div class="CommonListArea">
			<h4 class="CommonListTitle"><CS:ResourceLabel runat="server" ResourceName="ViewThreads_Posts" id="Resourcelabel10" /></h4>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<thead>
					<tr>
						<th class="CommonListHeaderLeftMost ForumMyImageAndNameHeader" colspan="2"><CS:ResourceLabel runat="server" ResourceName="ViewThreads_TitleThread" id="Resourcelabel5"/></th>
						<th class="CommonListHeader ForumMyRepliesHeader"><CS:ResourceLabel runat="server" ResourceName="ViewThreads_TitleReplies" id="Resourcelabel2"/></th>
						<th id="moveThreadsColumnHeader" class="CommonListHeader ForumMyMoveHeader" runat="server" visible=<%# CSContext.Current.User.IsForumAdministrator | CSContext.Current.User.IsModerator %>>&nbsp;</th> 
					</tr>
				</thead>
				<tbody>
		</HeaderTemplate>
		<ItemTemplate>
				<tr>
					<td class="ForumListCellLeftMostImageOnly ForumMyImageColumn">
						<%# ForumFormatter.StatusIcon( (Thread) Container.DataItem ) %>
					</td>
					<td class="CommonListCell ForumMyNameColumn">
						<table width="100%" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td class="ForumSubListCellLeftMost"><%# Formatter.GetEmotionMarkup( ((Thread) Container.DataItem).EmoticonID ) %>
									<a class="<%# ReadLink((Thread) Container.DataItem) %>" 
										title="<%# ( ForumConfiguration.Instance().EnablePostPreviewPopup && CSContext.Current.User.Profile.EnablePostPreviewPopup  ? Formatter.CheckStringLength(Formatter.StripAllTags(DataBinder.Eval(Container.DataItem, "Body").ToString()), 300) : String.Empty )%>" 
										href="<%# Globals.GetSiteUrls().Post( ((Thread) Container.DataItem).PostID)  %> "> 
										<%# Formatter.CheckStringLength( ((Thread)Container.DataItem).Subject , 65) %>
									</a>
								</td>
								<td class="ForumSubListCell" align="right" nowrap="true">
									<CSD:RatePost IsReadOnly="true" PostID='<%# ((Thread) Container.DataItem).PostID %>' CurrentRating='<%# ((Thread) Container.DataItem).RatingAverage %>' CurrentVotes='<%# ((Thread) Container.DataItem).TotalRatings %>'  ThreadID='<%# ((Thread) Container.DataItem).ThreadID %>' Visible='<%# (CSContext.Current.SiteSettings.SectionRatingType == SectionRatingType.ThreadRating) %>' id="Ratepost1" runat="server" CssClass="CommonRateControl" ReadOnlyCssClass="CommonRateControlReadOnly" ActiveCssClass="CommonRateControlActive" ImagesBaseUrl="~/Themes/default/images/common/" />
									<CSD:ThreadStatusImage ThreadStatus='<%# ((Thread) Container.DataItem).Status %>' runat="server" id="ThreadItemStatusImage" />
								</td>
							</tr>
						</table>
						<table width="100%" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td class="ForumSubListCellLeftMost ForumLastPost">
									<%# ForumFormatter.FormatLastPost( (Thread) Container.DataItem, true ) %>
								</td>
								<td class="ForumSubListCellPager">
									<CSD:ThreadPager runat="server" ThreadID='<%# ((Thread)Container.DataItem).PostID %>' Replies='<%# ((Thread)Container.DataItem).Replies %>' id="Threadpager2" NAME="Threadpager2"/>
								</td>
							</tr>
						</table>
					</td>
					<td class="CommonListCell ForumMyRepliesColumn">
						<%# Formatter.FormatNumber( ((Thread) Container.DataItem).Replies ) %>
					</td>
					<td class="CommonListCell ForumMyMoveColumn" enableviewstate="false" align="center" id="moveThreadsCheckColumn" runat="server" value='<%# ((Thread)Container.DataItem).PostID %>'  visible=<%# CSContext.Current.User.IsForumAdministrator | CSContext.Current.User.IsModerator %>><csd:MoveThreadCheckBox value='<%# ((Thread)Container.DataItem).PostID %>' id="moveThisThread" EnableViewState="False" Runat="server" /></td>
				</tr>				
		</ItemTemplate>
		<FooterTemplate>
			</tbody>
			</table>
			</div>
		</FooterTemplate>
	</asp:Repeater>

	<table cellpadding="0" cellspacing="0" width="100%" border="0">
		<tr>
			<td valign="top" align="left">
				<CSD:ForumImageButton ButtonType="ForumSettings" runat="server" id="ForumSettings" />
				<%-- <div class="CommonBreadCrumbArea"><CSD:BreadCrumb ShowHome="true" runat="server" id="Breadcrumb1"/></div> --%>
			</td>	
			<td valign="top">
				<asp:Panel id="DisplayPager" Visible="True" Runat="server" align="right" CssClass="CommonPagingArea">
					<CS:CurrentPage Cssclass="columnText" id="Currentpage" runat="server" />
					<CSD:ForumPager id="Pager" runat="server" />
				</asp:Panel>
			</td> 
		</tr>
	</table>
	
	<div class="CommonFormArea">
		<table cellpadding="0" cellspacing="0" border="0" width="100%">
			<tr>
				<td align="right" class="CommonFormField">
					<CS:ResourceLinkButton id="moveThreads" runat="server" ResourceName="Move" class="CommonTextButton" />
				</td>
			</tr>
		</table>
	</div>

	<div style="display:none;" id="ForumSettings">
		<div class="CommonFormArea">
		<fieldset>
		    <legend><CS:ResourceLabel runat="server" ResourceName="ViewThreads_ForumOptions" id="Resourcelabel9" NAME="Resourcelabel9"/></legend>
		    <table cellpadding="0" cellspacing="0" width="100%" border="0">
			    <tr>
				    <td align="left" class="CommonFormFieldName" nowrap="true">
					    <CS:ResourceLabel runat="server" ResourceName="ViewThreads_SortedBy" />
				    </td>
				    <td align="left" class="CommonFormField">
					    <CSD:ThreadSortDropDownList id="SortThreads" runat="server" /><CS:ResourceLabel runat="server" ResourceName="ViewThreads_In" /><CS:SortOrderDropDownList id="SortOrder" runat="server" /><CS:ResourceLabel runat="server" ResourceName="ViewThreads_OrderFrom" />
				    </td>
				    <td align="right" valign="top" class="CommonFormField" nowrap="true" rowspan=5>
					    <CSD:UserPermissions runat="server" id="Userpermissions1" />
				    </td>
			    </tr>
			    <tr>
				    <td align="left" class="CommonFormFieldName" nowrap="true">
					    <CS:ResourceLabel runat="server" ResourceName="ViewThreads_FilterByDate" />
				    </td>
				    <td align="left" class="CommonFormField">
					    <CS:DateFilter id="DateFilter" runat="server" AddText="false" AppendLineBreak="false" />
				    </td>
			    </tr>
			    <tr id="FilterTopicRow" runat="server">
				    <td align="left" class="CommonFormFieldName" nowrap="true">
					    <CS:ResourceLabel runat="server" ResourceName="ViewThreads_FilterByTopic" />
				    </td>
				    <td align="left" class="CommonFormField">	
					    <CSD:HideReadPostsDropDownList runat="server" id="HideReadPosts" />
					    <CS:FilterUsersDropDownList runat="server" id="FilterUsers" />
				    </td>
			    </tr>
			    <tr id="EmailNotificationRow" runat="server">
				    <td align="left" class="CommonFormFieldName" nowrap="true">
					    <CS:ResourceLabel runat="server" ResourceName="EmailNotificationDropDownList_When" />
				    </td>
				    <td align="left" class="CommonFormField">
					    <CSD:EmailNotificationDropDownList id="ForumTrackingDDL" Runat="server" />
				    </td>
			    </tr>
			    <tr>
				    <td align="right" class="CommonFormField" colspan="2" nowrap="true">
					    <asp:Button id="SortThreadsButton" runat="server" />
					    <asp:Button id="RememberSettingsButton" runat="server" />
					    <CSD:MarkAllRead runat="server" id="MarkAllRead" NAME="Markallread1" />
				    </td>
			    </tr>
		    </table>
		</fieldset>
		</div>
	</div>
	
	<div align="right" class="CommonFeedArea">
		<CSD:NntpLink runat="server" id="NntpLink" />
		<CSD:EmailLink runat="server" id="EmailLink" />
		<CSD:AggregateRssLink id="AggregateRssLink" runat="server" visible="false" />
		<CSD:RssLink id="RssLink" runat="server" />
	</div>
	<CS:AdPart runat = "Server" contentname="StandardBottom" ID="Adpart2">
	    <CS:Ads Zone="StandardBottom" runat="server" id="Ads3" />
	</CS:AdPart>

</div>
